﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Refraction
{
    public class CModel : Actor
    {
        public CModel(Game game, Vector3 position) : base(game, position)
        {   
        }

        protected override void LoadContent()
        {
            _effect = Game.Content.Load<Effect>("Shaders/SimpleEffect");
            _model = Game.Content.Load<Model>("Models/ball");

            Texture2D texture = Game.Content.Load<Texture2D>("Textures/metallic");
            _effect.Parameters["Texture"].SetValue(texture);

            base.LoadContent();
        }

        public override void Update(GameTime gameTime)
        {
            _effect.Parameters["View"].SetValue(Camera.view);
            _effect.Parameters["Projection"].SetValue(Camera.projection);

            base.Update(gameTime);
        }

        public override void Draw(GameTime gameTime)
        {
            Matrix world = Matrix.CreateRotationX(-MathHelper.PiOver2) *  Matrix.CreateScale(2f)*Matrix.CreateTranslation(Position);

            DrawModel(world);

            base.Draw(gameTime);
        }
    }
}
